
<div id="show_column_user_show">
  <div class="heading1">
    Employee Information
  </div>
  
  <div class="user_row1" style="width:89%">
    <span class="tutorial_tn">
      <img class="thumbnails"/>	
    </span>
    <h3 class="tutorial_details">
      <%=@user.chinese_name %> <%=@user.english_name %> 
    </h3>
    <span class="tutorial_details_report">
    </span>
    <span class="tutorial_details_left">
	  ID:<%=@user.employee_id %><br/>
      Last Name:<%=@user.last_name %><br/>
      First Name:<%=@user.first_name %><br/>
      Department:<%=@user.department.name %><br/>
      Email:<%#= mail_to(@user.email+'@pg.com',@user.email) %>
		<% if @user.email.include?("@") %>
			<a href="mailto:<%= @user.email %>"><%= @user.email %></a>
		<% else %>
			<a href="mailto:<%= @user.email %>@pg.com"><%= @user.email %></a>
			<%#= mail_to(user.email+'@pg.com',user.email) %>
		<% end %>
		<br/>
      Business Unit:<%=@user.business_unit %><br/>
    </span>
    <div class="tutorial_details_right">
      Ext:<%=@user.ext %><br/>
      Total Coupons:<%=@user.total_coupons %><br/>
      Total Out:<%=@user.total_out %><br/>
      Remaining:<%=@user.remaining %><br/>
    </div>
  </div>
  <br>
  <div style="padding:20px;margin:20px;">
       <%= link_to 'Back', "/users" %> |
        <%= link_to 'Edit', edit_user_path(@user) %>
                         
  </div>
  
  
  
  <div class="heading2" style="width:90%">
    Tests List
  </div>
  <% if @projects.size > 0  %> 
  <table summary="Projects List" id="user_show_projects_list" style="width:92%">
    <thead>
      <tr>
        <th scope="col">Name</th>
        <th scope="col">Owner</th>
        <th scope="col">Point</th>
        <th scope="col">Date</th>
      </tr>
    </thead>
    
    <% for project in @projects %>
        <tr>
          <td align="left" style="padding-left:5px;"><%= link_to project.name,project_path(project) %></td>
          <td><%= project.owner %></td>
          <td><%= project.projectusers.find_by_user_id(@user.id).point.to_i %></td>
          <td><%= project.created_at.strftime("%Y-%m-%d") %></td>
        </tr>

    <% end %>
    <tr style="background-color: #e0e0e0;">
      <td colspan="2" style="text-align: right;padding-right: 15px;"><b>Total: </b></td>
      <td><b><%= @tests_coupons %></b></td>
      <td></td>
    </tr>
  </table>
  <%  else %>
    <b>no test</b>
  <% end  %>
  <br/>
  
  <div class="heading3" style="width:90%">
    Products List
  </div>
  

    <% if @productusers.size > 0  %> 
  <table border="0" cellspacing="5" cellpadding="5" id="user_show_projects_list"  style="width:92%">
  <thead>
    <tr>
		<th>产品</th>
	    <th>单价</th>
	    <th>数量</th>
	    <th>总计</th>
	    <th>领取时间</th>
		<th colspan="2" scope="col">Action</th>
	</tr>
	
  </thead>

    <% for pu in @productusers %>
        <tr><td><%= link_to pu.product.cn_name,"/products/#{pu.product.id}" %>        </td>
              <td><%= pu.per_cost %>        </td>
              <td><%= pu.amount %>          </td>
              <td><%= pu.total_cost %>    </td>
              <td><%= pu.created_at.strftime("%Y-%m-%d") %>    </td>
			 <td><%= link_to image_tag("/images/edit2.png",:width => 16,:height => 16,:alt => "Edit?",:title => "Edit?"), {:controller => 'productusers',:action => :edit,:id => pu} %></td>
			 <td><%= link_to image_tag("/images/delete.gif",:alt => "Delete?",:title => "Delete?"), {:controller => 'productusers',:action => :destroy,:id => pu},:confirm => "Are you sure you want to delete?",:method => :delete %></td>
        </tr>
    <% end %>
    
    <tr style="background-color: #e0e0e0;">
      <td colspan="3" style="text-align: right;padding-right: 15px;"><b>Total: </b></td>
      <td><b><%= -@user.total_out %></b></td>
      <td></td>      <td></td>      <td></td>
    </tr>
  </table>
  <% else  %>
     <b>no product</b>
  <%  end %>
  <p/>
  <div id="user_add_a_product" >
    <%= link_to "Add a product",{:action=>'add_products',:id => @user},:class=>"link_as_button",:popup => true %>
  </div>
  
</div>
<!--
<div id="show_column_2">
  
<%#= render :partial => "right" %>	
</div>
-->

